# Copyright (c) 2008-2009 Mikhail Chernov 
#
# This file is part of dcExplorer.
#
# dcExplorer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# dcExplorer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with dcExplorer.  If not, see <http://www.gnu.org/licenses/>.

package dcExplorer::wxui::dialog::FleetNames;
use strict;
use utf8;
use Wx;
use base 'Wx::Dialog';
use Wx qw(wxHORIZONTAL wxVERTICAL wxEXPAND wxALL wxOK wxCANCEL wxTE_PASSWORD);

sub new {
	my $proto = shift;
	my $class = ref($proto) || $proto;
	my $parent = shift;
	my $internalDefault = shift || "";
	my $publicDefault = shift || "";
	my $self = $class->SUPER::new($parent, -1, "New fleet name", [-1, -1], [-1, -1]);
	my $main_sizer = Wx::BoxSizer->new(wxVERTICAL);
	$self->SetSizer($main_sizer);
	$self->{Name} = Wx::TextCtrl->new($self, -1, $internalDefault);
	$self->{ExtName} = Wx::TextCtrl->new($self, -1, $publicDefault);
	$main_sizer->Add(Wx::StaticText->new($self, -1, "Internal name:"));
	$main_sizer->Add($self->{Name}, 0, wxEXPAND, wxALL, 5);
	$main_sizer->Add(Wx::StaticText->new($self, -1, "Public name:"));
	$main_sizer->Add($self->{ExtName}, 0, wxEXPAND, wxALL, 5);
	$main_sizer->Add($self->CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND, wxALL, 5);
	$self->Fit();
	$self->{Name}->SetFocus();
	return $self;
}

sub GetName
{
	my $self = shift;
	return $self->{Name}->GetValue();
}

sub GetExtName
{
	my $self = shift;
	return $self->{ExtName}->GetValue();
}

1;
